/**
 * 控制台首页
 */
import $_fn from '~plugins'
module.exports = angular.module("app.index").controller("indexCtrl",['$scope','$ui',"http",function($scope,$ui,http) {
	$scope.operation = function (path,item) {
			console.log('111')
	        var _path = path.split('@')
	        let params = JSON.stringify(item)
	        if(_path[0] == 'link'){
	            console.log(path)
	            $state.go(_path[1],{id:1,ids:2})
	        }
	        if(_path[0] == 'alert'){
	            $ui.modal({content:"<"+_path[1]+" params="+params+"></"+_path[1]+">"})
	        }
	  }
	//控制台数据请求
	$scope.kongZhiTai=function(fn){
		console.log('控制台数据请求')
		http.post('consoleStatistics.do',{},function (data) {
      			console.log(data)
				if(data.errcode==1){
					// fn(data)
					$scope.$apply(function(){
						$scope.data = data.data
						$scope.dataCount = $scope.data.consoleTotal
						$scope.chartsline = $scope.data.entryTrend
						$scope.chartspie = $scope.data.consolePieChart.getOrderStatusPie
						$scope.chartsdai = $scope.data.consolePieChart.getLoanWayPie
						$scope.chartsstaff = $scope.data.consolePieChart.getUserLockedPie
						$scope.top = $scope.data.consolePieChart.rankingList
						$scope.chartsorder = $scope.data.orderStatus
					})
					
				}else{
					$ui.toast({
						text:data.errmsg,
						type:'warning'
					})
				}
	        },function(_data){
	            console.log(_data);//报错
	      	})
	}
	$scope.kongZhiTai()
	//
}]).name;
